﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Globalization;
using System.Web;
using System.Web.Routing;
using JXT.PrimaryKey.Batman.Language;
using JXT.PrimaryKey.Batman.Core.Configuration;

namespace JXT.PrimaryKey.Batman.Core.Infrastructure
{
    public class SupernovaWebContext : SupernovaContext
    {
        public SupernovaWebContext(RequestContext requestContext, RouteCollection routes, ILanguage language)
            : base(language)
        {
            HttpContext = requestContext.HttpContext;
            RequestContext = requestContext;
            Routes = routes;
        }

        public HttpContextBase HttpContext { get; private set; }

        public RequestContext RequestContext { get; private set; }

        public RouteCollection Routes { get; private set; }

        private WebConfigurationSection _configuration;

        public new WebConfigurationSection Configuration
        {
            get
            {
                if (_configuration == null)
                {
                    _configuration = SupernovaConfigurationManager.GetWebConfigurationSection();
                }
                return _configuration;
            }
        }
    }
}
